package myweka;

import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.IOException;

import myio.FileIO;

import weka.core.Instances;

public class wekautilities {

	public static Instances readDataFromFile(String path){
		Instances result = null;
		try{
		    FileReader reader = new FileReader(path); 
		    result = new Instances(reader);
		}
		catch (IOException e) {System.out.println(e);}
		return result;
	}
	
	public static void saveDataToFile(Instances data, String path){
		try{
		    BufferedWriter bw = FileIO.openOutputFile(path);
		    bw.write(data.toString());
		    bw.close();
		}
		catch (IOException e) {System.out.println(e);}
	}
}
